package com.item.controller;


import com.item.domain.VideoPay;
import com.item.service.VideoPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class VideoPayController {

    @Autowired
    VideoPayService videoPayService;

    @PostMapping(value = "/videoPay/{limit}/{page}")
    public List<VideoPay> videoPay(
            @PathVariable(value = "limit", required = false) int limit,
            @PathVariable(value = "page", required = false) int page,
            @RequestBody(required = false) VideoPay videoPay) {

        List<VideoPay> videoPays = videoPayService.findAll(limit, page, videoPay);
        return videoPays;
    }

    @PostMapping(value = "/videoPay/add")
    public Integer videoPayAdd(@RequestBody VideoPay videoPay) {

        int i = videoPayService.add(videoPay);
        return i;
    }

    @PutMapping(value = "/videoPay/update")
    public Integer videoPayUpdate(@RequestBody VideoPay videoPay) {

        int i = videoPayService.update(videoPay);
        return i;
    }

    @DeleteMapping(value = "/videoPay/{id}")
    public Integer videoPayDelete(@PathVariable(value = "id") int id) {

        int i = videoPayService.delete(id);
        return i;
    }
}
